using System;
using System.Collections.Generic;
using System.Text;

namespace CodePlex.Resourceful.Amazon.S3
{
    public class AmazonCustomerByEmail : ACLPrincipal
    {
        private readonly string _emailAddress;

        public AmazonCustomerByEmail(string emailAddress) : base(null,null,false)
        {
            _emailAddress = emailAddress;
        }

        public string EmailAddress
        {
            get
            {
                return _emailAddress;
            }
        }

        public override string ID
        {
            get
            {
                throw new NotImplementedException();
            }
        }

        public override string Name
        {
            get
            {
                return this.EmailAddress;
            }
        }

        public override string ToString()
        {
            return string.Format("{0}({1})", this.GetType().Name, this.EmailAddress);
        }

        public override int GetHashCode()
        {
            return _emailAddress.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            AmazonCustomerByEmail other = obj as AmazonCustomerByEmail;

            return other != null && other.EmailAddress == this.EmailAddress;
        }

    }
}
